package cn.ellacat.game.guess;

import java.util.Scanner;

/**
 * @author wjc133
 */
public class ConsoleIoController implements IoController {

    private final Scanner scanner = new Scanner(System.in);

    @Override
    public void init() {
        // no-op
    }

    @Override
    public int inInt() {
        return this.scanner.nextInt();
    }

    @Override
    public String inString() {
        return this.scanner.nextLine();
    }

    @Override
    public Object inObject() throws GuessYouException {
        throw new GuessYouException(StatusCode.NOT_SUPPORT);
    }

    @Override
    public <T> T inObject(final Class<T> clz) throws GuessYouException {
        throw new GuessYouException(StatusCode.NOT_SUPPORT);
    }

    @Override
    public void outLine(final String str) {
        System.out.println(str);
    }

    @Override
    public void outString(final String str) throws GuessYouException {
        System.out.print(str);
    }

    @Override
    public void outInt(final int i) {
        System.out.println(i);
    }

    @Override
    public void outObject(final Object obj) {
        System.out.println(obj);
    }
}
